Patch from <chinen@jp.ibm.com> to handle RTL support for column resizers,
authorJonathan Blandford <jrb@gnome.org>
Sat, 29 Nov 2003 06:16:11 +0000 (06:16 +0000)
committerJonathan Blandford <jrb@src.gnome.org>
Sat, 29 Nov 2003 06:16:11 +0000 (06:16 +0000)
Sat Nov 29 00:55:28 2003  Jonathan Blandford  <jrb@gnome.org>

* gtk/gtktreeview.c (gtk_tree_view_new_column_width):
* gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
Patch from <chinen@jp.ibm.com> to handle RTL support for column
resizers, #127874

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktreeview.c
gtk/gtktreeviewcolumn.c

index 9d498451dc86784fa556330302efecbe61ce39ab..4b9f12736fc06bc1958d40756965307ade73825e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Nov 29 00:55:28 2003  Jonathan Blandford  <jrb@gnome.org>
+
+       * gtk/gtktreeview.c (gtk_tree_view_new_column_width): 
+       * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
+       Patch from <chinen@jp.ibm.com> to handle RTL support for column
+       resizers, #127874
+
 Fri Nov 28 00:26:24 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfilesystemmodel.c (gtk_file_system_model_finalize): 
index 9d498451dc86784fa556330302efecbe61ce39ab..4b9f12736fc06bc1958d40756965307ade73825e 100644 (file)
@@ -1,3 +1,10 @@
+Sat Nov 29 00:55:28 2003  Jonathan Blandford  <jrb@gnome.org>
+
+       * gtk/gtktreeview.c (gtk_tree_view_new_column_width): 
+       * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
+       Patch from <chinen@jp.ibm.com> to handle RTL support for column
+       resizers, #127874
+
 Fri Nov 28 00:26:24 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfilesystemmodel.c (gtk_file_system_model_finalize): 
index 9d498451dc86784fa556330302efecbe61ce39ab..4b9f12736fc06bc1958d40756965307ade73825e 100644 (file)
@@ -1,3 +1,10 @@
+Sat Nov 29 00:55:28 2003  Jonathan Blandford  <jrb@gnome.org>
+
+       * gtk/gtktreeview.c (gtk_tree_view_new_column_width): 
+       * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
+       Patch from <chinen@jp.ibm.com> to handle RTL support for column
+       resizers, #127874
+
 Fri Nov 28 00:26:24 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfilesystemmodel.c (gtk_file_system_model_finalize): 
index 9d498451dc86784fa556330302efecbe61ce39ab..4b9f12736fc06bc1958d40756965307ade73825e 100644 (file)
@@ -1,3 +1,10 @@
+Sat Nov 29 00:55:28 2003  Jonathan Blandford  <jrb@gnome.org>
+
+       * gtk/gtktreeview.c (gtk_tree_view_new_column_width): 
+       * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
+       Patch from <chinen@jp.ibm.com> to handle RTL support for column
+       resizers, #127874
+
 Fri Nov 28 00:26:24 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfilesystemmodel.c (gtk_file_system_model_finalize): 
index 9d498451dc86784fa556330302efecbe61ce39ab..4b9f12736fc06bc1958d40756965307ade73825e 100644 (file)
@@ -1,3 +1,10 @@
+Sat Nov 29 00:55:28 2003  Jonathan Blandford  <jrb@gnome.org>
+
+       * gtk/gtktreeview.c (gtk_tree_view_new_column_width): 
+       * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_realize_button):
+       Patch from <chinen@jp.ibm.com> to handle RTL support for column
+       resizers, #127874
+
 Fri Nov 28 00:26:24 2003  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfilesystemmodel.c (gtk_file_system_model_finalize): 
index f04ad6faa01ec7aac108f9bf0369a17083526f61..d21bc34753847d9a5537a6ba086a2d195dbaccef 100644 (file)
@@ -1825,7 +1825,7 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget)
 
       if (column->window)
        gdk_window_move_resize (column->window,
-                                allocation.x + allocation.width - TREE_VIEW_DRAG_WIDTH/2,
+                                allocation.x + (rtl ? 0 : allocation.width) - TREE_VIEW_DRAG_WIDTH/2,
                                allocation.y,
                                 TREE_VIEW_DRAG_WIDTH, allocation.height);
     }
@@ -1951,11 +1951,13 @@ gtk_tree_view_button_press (GtkWidget      *widget,
   GdkRectangle cell_area;
   gint vertical_separator;
   gint horizontal_separator;
+  gboolean rtl;
 
   g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
   g_return_val_if_fail (event != NULL, FALSE);
 
   tree_view = GTK_TREE_VIEW (widget);
+  rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
   gtk_tree_view_stop_editing (tree_view, FALSE);
   gtk_widget_style_get (widget,
                        "vertical_separator", &vertical_separator,
@@ -2294,7 +2296,7 @@ gtk_tree_view_button_press (GtkWidget      *widget,
            gtk_widget_grab_focus (widget);
 
          tree_view->priv->drag_pos = i;
-         tree_view->priv->x_drag = (column->button->allocation.x + column->button->allocation.width);
+         tree_view->priv->x_drag = column->button->allocation.x + (rtl ? 0 : column->button->allocation.width);
          break;
        }
     }
@@ -8253,14 +8255,15 @@ gtk_tree_view_new_column_width (GtkTreeView *tree_view,
 {
   GtkTreeViewColumn *column;
   gint width;
+  gboolean rtl;
 
   /* first translate the x position from widget->window
    * to clist->clist_window
    */
-
+  rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
   column = g_list_nth (tree_view->priv->columns, i)->data;
-  width = *x - column->button->allocation.x;
-
+  width = rtl ? (column->button->allocation.x + column->button->allocation.width - *x) : (*x - column->button->allocation.x);
   /* Clamp down the value */
   if (column->min_width == -1)
     width = MAX (column->button->requisition.width,
@@ -8270,8 +8273,9 @@ gtk_tree_view_new_column_width (GtkTreeView *tree_view,
                 width);
   if (column->max_width != -1)
     width = MIN (width, column->max_width != -1);
-  *x = column->button->allocation.x + width;
 
+  *x = rtl ? (column->button->allocation.x + column->button->allocation.width - width) : (column->button->allocation.x + width);
   return width;
 }
 
index 4e176ff5ccf147a14959c9577ae70f5c6dfb1f53..6bd4000e6f0daea757aa3cce12bd55ad979cc5da 100644 (file)
@@ -1187,8 +1187,10 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
   GtkTreeView *tree_view;
   GdkWindowAttr attr;
   guint attributes_mask;
+  gboolean rtl;
 
   tree_view = (GtkTreeView *)column->tree_view;
+  rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
 
   g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
   g_return_if_fail (GTK_WIDGET_REALIZED (tree_view));
@@ -1217,8 +1219,7 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
   attr.width = TREE_VIEW_DRAG_WIDTH;
   attr.height = tree_view->priv->header_height;
 
-  attr.x = (column->button->allocation.x + column->button->allocation.width) - 3;
-          
+  attr.x = (column->button->allocation.x + (rtl ? 0 : column->button->allocation.width)) - 3;
   column->window = gdk_window_new (tree_view->priv->header_window,
                                   &attr, attributes_mask);
   gdk_window_set_user_data (column->window, tree_view);